<?php
$studentId = $_POST['student_id'] ?? '';
$studentName = $_POST['student_name'] ?? '';
$studentSex = $_POST['student_sex'] ?? '';
$studentBirthday = $_POST['student_birthday'] ?? '';
$studentAddress = $_POST['student_address'] ?? '';
$classId = $_POST['class_id'] ?? 0;

$dsn = "sqlsrv:Server=LAPTOP-LD8O4C6L\SQLEXPRESS;Database=Student";
$db = new PDO($dsn,"sa","123456");
$sql = "update Student set StudentName='{$studentName}', StudentSex='{$studentSex}', StudentBirth='{$studentBirthday}', StudentAddress='{$studentAddress}'
,ClassId ='{$classId}'	where StudentId='{$studentId}'";
$result = $db->exec($sql);
if ($result){
    echo "修改成功"."<a href='student_list.php'>返回列表页</a>";
}else{
    echo "修改失败";
}
?>